﻿using DBServer.Selenium.Extenium.Path;
using Selenium;

namespace DBServer.Selenium.Extenium.Fixtures
{
    public class MenuItemFixture : MenuFixture
    {
        public MenuItemFixture(ISelenium driver, string path) : base(driver, new PlainPath(path))
        {
        }

        public MenuItemFixture Expand()
        {
            SafeExec(Path + ".expand()");
            Wait(EvalToFalse(Path + ".collapsed"));
            return this;
        }

        public MenuItemFixture Collapse()
        {
            SafeExec(Path + ".collapse()");
            Wait(EvalToTrue(Path + ".collapsed"));
            return this;
        }

        public MenuItemFixture Select()
        {
            SafeExec(Path + ".onClick()");
            return this;
        }


        public MenuItemFixture Click()
        {
            SafeExec(Path + ".el.dom.click()");
            return this;
        }

    }
}